//
// GPSMapEdit
// (c) Konstantin Galichsky (kg@geopainting.com), 2006-2007
//
// The NaviTel-specific type set.
//

# include "StdAfx.h"
# include "Resource.h"
# include "NavitelTypes.h"
# include "RussaTypes.h"
# include "GarminTypes.h"
# include "GarminRound.h"
# include "Map.h"
# include "TypesDraw.h"
# include "TypesPOIDraw.h"
# include "Globals.h"

bool Navitel_IsRoad (USHORT _ushType) {
	if (_ushType == 0x42 || _ushType == 0x43 || _ushType == 0x48 || _ushType == 0x49)
		return true;

	return Garmin_IsRoad (_ushType);
}

bool Navitel_IsRoad (const rgn_t & _rgn) {
	return _rgn.IsPolyline () && Navitel_IsRoad (_rgn.ushType);
}

bool Navitel_IsUnpavedRoad (const rgn_t & _rgn) {
	return _rgn.IsPolyline () && (_rgn.ushType == 0x0a || _rgn.ushType == 0x42);
}

//////////////////////////////////////////////////////

struct POI_desc_t {
	BYTE btPointCode;
	BYTE btPOISubcodeMin;
	BYTE btPOISubcodeMax;
	BYTE btCategory;

	char * strTypeName;

		// The icon for point/POI. NOTE: can't be NULL; use g_hcurUnknown for default.
	HCURSOR *      phCursor;

	label_desc_t * pLabelDesc;
};

static POI_desc_t g_POIs [] = {
	{0xF0, 0x01, 0, catTransport, "Bus station",         & g_hcurBusStation},
	{0xF0, 0x02, 0, catTransport, "Bus stop",            & g_hcurBusStop},
	{0xF0, 0x03, 0, catTransport, "Tram stop",           & g_hcurTramStop},
	{0xF0, 0x04, 0, catTransport, "Trolley bus stop",    & g_hcurTrolleyStop},
	{0xF0, 0x05, 0, catTransport, "Underground/Subway/Metro station", & g_hcurUGStation},
	{0xF0, 0x06, 0, catTransport, "Railway station",     & g_hcurRWStation},
	{0xF0, 0x07, 0, catTransport, "Railway terminal",    & g_hcurRWTerminal},
	{0xF0, 0x08, 0, catTransport, "Monorail station",    & g_hcurRWStation},
	{0xF0, 0x09, 0, catTransport, "Cable car stop",      & g_hcurCableCar},
	{0xF0, 0x0a, 0, catTransport, "Port",                & g_hcurPort},
	{0xF0, 0x0b, 0, catTransport, "Wharf",               & g_hcurWharf},
	{0xF0, 0x0c, 0, catTransport, "Ferry terminal",      & g_hcurFerryTerminal},

	{0xF1, 0x01, 0, catReligion,  "Orthodox church",     & g_hcurChurchOrthodox},
	{0xF1, 0x02, 0, catReligion,  "Catholic church",     & g_hcurChurchCatholic},
	{0xF1, 0x03, 0, catReligion,  "Protestant church",   & g_hcurChurchProtestant},
	{0xF1, 0x04, 0, catReligion,  "Mosque",              & g_hcurMosque},
	{0xF1, 0x05, 0, catReligion,  "Synagogue",           & g_hcurSynagogue},
	{0xF1, 0x06, 0, catReligion,  "Pagoda",              & g_hcurPagoda},
	// Chapel
	// Monastery
	// Mazar
	// Suburgan
	// Obo

	{0xF2, 0x01, 0, catAuto,      "Traffic light",       & g_hcurTrafficLight},
	{0xF2, 0x02, 0, catAuto,      "Traffic police",      & g_hcurTrafficPolice},
	{0xF2, 0x03, 0, catAuto,      "Railway crossing (with barrier)", & g_hcurRWCrossing},
	{0xF2, 0x04, 0, catAuto,      "Rough road",          & g_hcurRoughRoad},
	{0xF2, 0x05, 0, catAuto,      "Radar",               & g_hcurRadar},
	{0xF2, 0x06, 0, catAuto,      "Height limit",        & g_hcurHeightLimit},
	{0xF2, 0x07, 0, catAuto,      "No transit traffic",  & g_hcurNoTransit},
	{0xF2, 0x08, 0, catAuto,      "Gas fuel",            & g_hcurGasFuel},

	{0xF3, 0x01, 0, catAttractions, "Monument",          & g_hcurMonument},
	{0xF3, 0x02, 0, catAttractions, "Fountain",          & g_hcurFountain},
	{0xF3, 0x03, 0, catManMade,   "Water tower",         & g_hcurWaterTower},
	{0xF3, 0x04, 0, catManMade,   "TV/radio tower",      & g_hcurRadioTower},
	{0xF3, 0x05, 0, catManMade,   "Geodetic point",      & g_hcurGeodeticPoint},
	{0xF3, 0x06, 0, catManMade,   "Mountain pass",       & g_hcurPassing},
	{0xF3, 0x07, 0, catManMade,   "Ford",                & g_hcurFord},
	{0xF3, 0x08, 0, catLand,      "Pit",                 & g_hcurPit},
	{0xF3, 0x09, 0, catLand,      "Barrow",              & g_hcurBarrow},
	{0xF3, 0x0a, 0, catLand,      "Stones",              & g_hcurStone},
	{0xF3, 0x0b, 0, catManMade,   "Peatery",             & g_hcurPeatery},
	{0xF3, 0x0c, 0, catManMade,   "Foot-bridge",         & g_hcurFootBridge},
	{0xF3, 0x0d, 0, catLand,      "Cavern entry",        & g_hcurCavernEntry},

	{0xF4, 0x01, 0, catLand,      "Deciduous forest",    & g_hcurDeciduousForest},
	{0xF4, 0x02, 0, catLand,      "Coniferous forest",   & g_hcurConiferousForest},
	{0xF4, 0x03, 0, catLand,      "Mixed forest",        & g_hcurMixedForest},
	{0xF4, 0x04, 0, catLand,      "Single tree",         & g_hcurSingleTree},
	{0xF4, 0x05, 0, catLand,      "Isolated bush",       & g_hcurIsolatedBush},
	{0xF4, 0x06, 0, catLand,      "Grove",               & g_hcurGrove},

	{0xF5, 0x01, 0, catEducation, "Nursery school",      & g_hcurNurserySchool},
	{0xF5, 0x02, 0, catEducation, "Secondary school",    & g_hcurSecondarySchool},
	{0xF5, 0x03, 0, catEducation, "Vocational school",   & g_hcurVocationalSchool},
	{0xF5, 0x04, 0, catEducation, "University/College",  & g_hcurCollege},
	{0xF5, 0x05, 0, catEducation, "Specialized school",  & g_hcurSpecializedSchool},

	{0xF6, 0x01, 0, catServices,  "ATM",                 & g_hcurATM},
	{0xF6, 0x02, 0, catServices,  "Hairdressing salon",  & g_hcurHairdressing},
};

struct polyline_desc_t {
	BYTE btCode;
	BYTE btCategory;

	char * strTypeName;

		// The pens to draw polylines.
	HPEN *         phPen;
		// The pen for second pass. NOTE: NULL means not to draw 2nd pass.
	HPEN *         phPen2;

	label_desc_t * pLabelDesc;
};

static polyline_desc_t g_Polylines [] = {
	{0x3d, catLabels,     "Directed text, small",   & g_hpenNull,         NULL,                 & g_RoadLabel},
	{0x3e, catLabels,     "Directed text",          & g_hpenNull,         NULL,                 & g_RoadLabel},

	{0x3f, catTransport,  "Tram line",              & g_hpenTramWay,      NULL,                 & g_RoadLabel},
	{0x40, catTransport,  "Monorail line",          & g_hpenTramWay,      NULL,                 & g_RoadLabel},
	{0x41, catTransport,  "Cable car line",         & g_hpenTramWay,      NULL,                 & g_RoadLabel},

	{0x42, catRoads,      "Earth or gravel road",   & g_hpenEarthRoad,    NULL,                 & g_RoadLabel},
	{0x43, catRoads,      "Tunnel",                 & g_hpenTunnelRoad,   NULL,                 & g_RoadLabel},
	{0x44, catWater,      "River, thick",           & g_hpenWideWater,    NULL,                 & g_LineRiverLabel},

	{0x45, catBoundaries, "City district boundary", & g_hpenBoundaryCnt1, & g_hpenBoundaryCnt2, & g_BoundaryLabel},
	{0x46, catManMade,    "Fence",                  & g_hpenFence,        NULL,                 & g_BoundaryLabel},

	{0x47, catRoads,      "Planned route",          & g_hpenPlannedRoute, NULL,                 & g_RoadLabel},
	{0x48, catRoads,      "Forest firebreak",       & g_hpenForestFirebreak, NULL,              & g_RoadLabel},
	{0x49, catRoads,      "Traffic lane",           & g_hpenTrafficLane,  NULL,                 & g_RoadLabel},
};

struct polygon_desc_t {
	BYTE btCode;
	BYTE btCategory;

	char * strTypeName;

		// The brush to fill polygons.
	HBRUSH *       phBrush;
		// The pen to draw border.
	HPEN *         phPen;

	label_desc_t * pLabelDesc;
};

static polygon_desc_t g_Polygons [] = {
	{0x68, catRoads,    "Collector road",         & g_hbrArterial,            & g_hpenNull},
	{0x69, catRoads,    "Arterial road",          & g_hbrArterial,            & g_hpenNull},
	{0x6a, catRoads,    "Square",                 & g_hbrSquare,              & g_hpenNull},
	{0x6b, catRoads,    "Road, street",           & g_hbrSquare,              & g_hpenNull},

	{0x6c, catBuilding, "Residential building",   & g_hbrResidentialBuilding, & g_hpenNull},
	{0x6d, catBuilding, "Office building",        & g_hbrOfficeBuilding,      & g_hpenNull},
	{0x6e, catBuilding, "Common building",        & g_hbrCommonBuilding,      & g_hpenNull},
	{0x6f, catBuilding, "Industrial building",    & g_hbrIndustrialBuilding,  & g_hpenNull},

	{0x70, catOthers,   "Black area",             & g_hbrBlack,             & g_hpenNull},
	{0x71, catOthers,   "Dark red area",          & g_hbrDkRed_special,     & g_hpenNull},
	{0x72, catOthers,   "Dark green area",        & g_hbrDkGreen_special,   & g_hpenNull},
	{0x73, catOthers,   "Dark yellow area",       & g_hbrDkYellow_special,  & g_hpenNull},
	{0x74, catOthers,   "Dark blue area",         & g_hbrDkBlue_special,    & g_hpenNull},
	{0x75, catOthers,   "Dark magenta area",      & g_hbrDkMagenta_special, & g_hpenNull},
	{0x76, catOthers,   "Dark cyan area",         & g_hbrDkCyan_special,    & g_hpenNull},
	{0x77, catOthers,   "Light gray area",        & g_hbrLtGray,            & g_hpenNull},
	{0x78, catOthers,   "Dark gray area",         & g_hbrGray,              & g_hpenNull},
	{0x79, catOthers,   "Red area",               & g_hbrRed_special,       & g_hpenNull},
	{0x7a, catOthers,   "Green area",             & g_hbrGreen_special,     & g_hpenNull},
	{0x7b, catOthers,   "Yellow area",            & g_hbrYellow_special,    & g_hpenNull},
	{0x7c, catOthers,   "Blue area",              & g_hbrBlue_special,      & g_hpenNull},
	{0x7d, catOthers,   "Magenta area",           & g_hbrMagenta_special,   & g_hpenNull},
	{0x7e, catOthers,   "Cyan area",              & g_hbrCyan_special,      & g_hpenNull},
	{0x7f, catOthers,   "White area",             & g_hbrWhite,             & g_hpenNull},

	{0x80, catLabels,   "Text area",              & g_hbrNull,              & g_hpenNull},
	{0x81, catLand,     "Swamp forest",           & g_hbrForestSwamp,       & g_hpenNull},
	{0x82, catLand,     "Undersized forest",      & g_hbrForestUndersized,  & g_hpenNull},
	{0x83, catLand,     "Sparse forest",          & g_hbrForestSparse,      & g_hpenNull},
	{0x84, catLand,     "Burnt/dead forest",      & g_hbrForestDead,        & g_hpenNull},
	{0x85, catLand,     "Stumped forest",         & g_hbrForestStumped,     & g_hpenNull},
	{0x86, catManMade,  "Vineyard",               & g_hbrVineyard,          & g_hpenNull},
	{0x87, catManMade,  "Rice field",             & g_hbrRiceField,         & g_hpenNull},
	{0x88, catLand,     "Meadow",                 & g_hbrMeadow,            & g_hpenNull},
	{0x89, catLand,     "Sand",                   & g_hbrSand,              & g_hpenNull},
	{0x8a, catLand,     "Stony land",             & g_hbrStony,             & g_hpenNull},
	{0x8b, catLand,     "Saline land/Salt-marsh", & g_hbrSaline,            & g_hpenNull},
	{0x8c, catWater,    "Reed",                   & g_hbrReed,              & g_hpenNull},
	{0x8d, catWater,    "Algae",                  & g_hbrAlgae,             & g_hpenNull},
	{0x8e, catLand,     "Thornbush",              & g_hbrThornbush,         & g_hpenNull},
	{0x8f, catLand,     "Wind-fallen trees",      & g_hbrWindFallenTrees,   & g_hpenNull},
	{0x90, catLand,     "Elfin wood",             & g_hbrElfinWood,         & g_hpenNull},
	{0x91, catLand,     "Saxaul",                 & g_hbrSaxaul,            & g_hpenNull},
	{0x92, catLand,     "Bamboo",                 & g_hbrBamboo,            & g_hpenNull},
	{0x93, catLand,     "Palm forest",            & g_hbrPalmForest,        & g_hpenNull},
	{0x94, catLand,     "Mangroves",              & g_hbrMangroves,         & g_hpenNull},
	{0x95, catLand,     "High grass",             & g_hbrHighGrass,         & g_hpenNull},
	{0x96, catLand,     "Mosses",                 & g_hbrMosses,            & g_hpenNull},
	{0x97, catLand,     "Lichens",                & g_hbrLichens,           & g_hpenNull},
	{0x98, catManMade,  "Grass-plot",             & g_hbrGreen_special,     & g_hpenNull},
};

static std::vector<type_desc_t> g_types_impl;

void InitNavitelTypes (std::vector<type_desc_t> & _types) {
	InitGarminTypes (_types);

	// Prepare POIs.
	size_t cPOI;
	for (cPOI = 0; cPOI < sizeof (g_POIs)/sizeof (g_POIs [0]); ++ cPOI) {
		const POI_desc_t & d = g_POIs [cPOI];

		_types.push_back (type_desc_t ());
		type_desc_t & td = _types.back ();

		td.ushType        = (USHORT (d.btPointCode) << 8) + d.btPOISubcodeMin;
		td.Kind           = rkPoint;
		td.ulType2        = td.ulType + (d.btPOISubcodeMax == 0 ? 0 : d.btPOISubcodeMax - d.btPOISubcodeMin);
		td.Category       = static_cast<type_category_t> (d.btCategory);

		td.strTypeName    = d.strTypeName;
		td.phCursor       = d.phCursor;

		const label_desc_t * const pLD = d.pLabelDesc ? d.pLabelDesc : & g_DefLabel;
		td.phFont         = pLD->phFont;
		td.colText        = pLD->colText;
		td.pfPrepareLabel = pLD->pfPrepareLabel;
		td.pfDrawLabel    = pLD->pfDrawLabel;
	}

	// Prepare polylines.
	for (size_t cPolyline = 0; cPolyline < sizeof (g_Polylines)/sizeof (g_Polylines [0]); ++ cPolyline) {
		const polyline_desc_t & d = g_Polylines [cPolyline];

		_types.push_back (type_desc_t ());
		type_desc_t & td = _types.back ();

		td.ushType        = d.btCode;
		td.Kind           = rkPolyline;
		td.ulType2        = td.ulType;
		td.Category       = static_cast<type_category_t> (d.btCategory);

		td.strTypeName    = d.strTypeName;
		td.phPen          = d.phPen;
		td.phPen2         = d.phPen2;

		const label_desc_t * const pLD = d.pLabelDesc ? d.pLabelDesc : & g_DefLabel;
		td.phFont         = pLD->phFont;
		td.colText        = pLD->colText;
		td.pfPrepareLabel = pLD->pfPrepareLabel;
		td.pfDrawLabel    = pLD->pfDrawLabel;
	}

	// Prepare polygons.
	for (size_t cPolygon = 0; cPolygon < sizeof (g_Polygons)/sizeof (g_Polygons [0]); ++ cPolygon) {
		const polygon_desc_t & d = g_Polygons [cPolygon];

		_types.push_back (type_desc_t ());
		type_desc_t & td = _types.back ();

		td.ushType        = d.btCode;
		td.Kind           = rkPolygon;
		td.ulType2        = td.ulType;
		td.Category       = static_cast<type_category_t> (d.btCategory);

		td.strTypeName    = d.strTypeName;
		td.phBrush        = d.phBrush;
		td.phPen          = d.phPen;

		const label_desc_t * const pLD = d.pLabelDesc ? d.pLabelDesc : & g_CenteredLabel;
		td.phFont         = pLD->phFont;
		td.colText        = pLD->colText;
		td.pfPrepareLabel = pLD->pfPrepareLabel;
		td.pfDrawLabel    = pLD->pfDrawLabel;
	}

	// Make sure all types are sorted by code (as required by GetTypeDesc()).
	std::sort (_types.begin (), _types.end ());
}

static
void _InitNavitelTypes () {
	InitNavitelTypes (g_types_impl);

	// NOTE: here is assumed that STL stores vector as plain array.
	g_tsNavitel.pTypes           = & g_types_impl [0];
	g_tsNavitel.cTypes           = g_types_impl.size ();

	g_tsNavitel.strID            = "Navitel";
	g_tsNavitel.strDisplayName   = "Navitel";

	g_tsNavitel.pfGetLatGrid     = GarminLatGrid;
	g_tsNavitel.pfRoundPoint     = GarminRoundPoint;
	g_tsNavitel.pfRoundPoints    = GarminRoundPoints;
	g_tsNavitel.pfRoundRect      = GarminRoundRect;

	g_tsNavitel.pfIsCity         = Garmin_IsCity;
	g_tsNavitel.pfIsHeight       = Garmin_IsHeight;
	g_tsNavitel.pfIsFeature      = Garmin_IsFeature;
	g_tsNavitel.pfIsRoad         = Navitel_IsRoad;
	g_tsNavitel.pfIsUnpavedRoad  = Navitel_IsUnpavedRoad;
	g_tsNavitel.pfIsHwExit       = RgnPredicateFalse;
	g_tsNavitel.pfIsBackground   = Garmin_IsBackground;
	g_tsNavitel.pfHasAddress     = RgnPredicateTrue;
	g_tsNavitel.pfHasCityAndZip  = RgnPredicateTrue;
	g_tsNavitel.pfHasPhone       = RgnPredicateTrue;
	g_tsNavitel.pfHasContact     = RgnPredicateTrue;
	g_tsNavitel.pfHasDescription = RgnPredicateTrue;

	g_tsNavitel.dwFeatures       = CTypeSet::tsfHasCopyright | CTypeSet::tsfHasElevationUnits;

	g_tsNavitel.cMaxBits         = 26;
}

static
void _DestroyNavitelTypes () {}

CTypeSet g_tsNavitel (_InitNavitelTypes, _DestroyNavitelTypes);

/////////////////////////////////////////////////////////////////////

USHORT ConvertTypeSet_Garmin2Navitel (RGN_KIND _Kind, USHORT _ushType) {
	return _ushType;
}

DECLARE_TYPESET_CONVERTOR (ConvertTypeSet_Garmin2Navitel, & g_tsGarmin, & g_tsNavitel);

USHORT ConvertTypeSet_Navitel2Garmin (RGN_KIND _Kind, USHORT _ushType) {
	switch (_Kind) {
		case rkPoint:
			switch (_ushType) {
				case 0xF001:
				case 0xF002:
				case 0xF003:
				case 0xF004:
				case 0xF005:
				case 0xF006:
				case 0xF007:
				case 0xF008:
				case 0xF009:
					return 0x2f08; // Ground transportation.

				case 0xF00a: // Port
				case 0xF00b: // Wharf
				case 0xF00c: // Ferry terminal
					return 0x4300; // Marina

				case 0xF101:
				case 0xF102:
				case 0xF103:
				case 0xF104:
				case 0xF105:
				case 0xF106:
					return 0x2c0b; // Palace of worship.

				case 0xF201: // Traffic light
					return 0x1616; // Navaid, multi colored
				case 0xF202: // Traffic police
					return 0x3001; // Police
				case 0xF203: // Railway crossing
					return 0x6406; // Crossing
				case 0xF204: // Rough road
					return 0x6400; // Man-made place
				case 0xF205: // Radar
					return 0x1602; // Radio beacon
				case 0xF206: // Height limit
				case 0xF207: // No transit traffic
					return 0x5800; // Restricted area
				case 0xF208: // Gas fuel
					return 0x2f01; // Auto fuel

				case 0xF301: // Monument
					return 0x5200; // Scenic area

				case 0xF302: // Fountain
					return 0x6509; // Geyser

				case 0xF303: // Water tower
				case 0xF304: // TV/radio tower
					return 0x6411; // Tower

				case 0xF305: // Geodetic point
					return 0x6400; // Man-made place

				case 0xF306: // Mountain pass
				case 0xF307: // Ford
					return 0x6406; // Crossing

				case 0xF308: // Pit
					return 0x6600; // Land feature
				case 0xF309: // Barrow
					return 0x6616; // Summit
				case 0xF30a: // Stones
					return 0x6614; // Rock

				case 0xF30b: // Peatery
					return 0x6400; // Man-made place

				case 0xF30c: // Foot-bridge
					return 0x6401; // Bridge
				case 0xF30d: // Cavern entry
					return 0x6413; // Tunnel

				case 0xF401: // Deciduous forest
				case 0xF402: // Coniferous forest
				case 0xF403: // Mixed forest
				case 0xF404: // Single tree
				case 0xF405: // Isolated bush
				case 0xF406: // Grove
					return 0x6618; // Wooded area

				case 0xF501: // Nursery school
				case 0xF502: // Secondary school
				case 0xF503: // Vocational school
				case 0xF504: // University/College
				case 0xF505: // Specialized school
					return 0x2c05; // School

				case 0xF601: // ATM
					return 0x2f06; // Bank/ATM
				case 0xF602: // Hairdressing
					return 0x2f00; // Generic services
			}
			break;

		case rkPolyline:
			switch (_ushType) {
				case 0x3f: // Tram line
				case 0x40: // Monorail
				case 0x41: // Cable car
					return 0x14; // Railroad

				case 0x42: // Earth road
					return 0x0A; // Unpaved road
				case 0x43: // Tunnel
					return 0x05; // Collector road

				case 0x44: // River, thick
					return 0x1f; // River
				case 0x45: // District boundary
				case 0x46: // Fence
					return 0x1d; // County/parish boundary

				case 0x48: // Forest firebreak
					return 0x16; // Path/Walkway
				case 0x49: // Traffic lane
					return 0x00; // Road
			}
			break;

		case rkPolygon:
			switch (_ushType) {
				case 0x69: // Arterial road
				case 0x6a: // Square
				case 0x6b: // Road, street
					return 0;

				case 0x6c: // Residential building
				case 0x6d: // Commercial building
				case 0x6e: // Community building
				case 0x6f: // Industrial building
					return 0x13; // Man-made area

				case 0x70: // Color area
				case 0x71:
				case 0x72:
				case 0x73:
				case 0x74:
				case 0x75:
				case 0x76:
				case 0x77:
				case 0x78:
				case 0x79:
				case 0x7a:
				case 0x7b:
				case 0x7c:
				case 0x7d:
				case 0x7e:
				case 0x7f:
				case 0x80: // Text area
					return 0;

				case 0x81: // Swamp forest
				case 0x82: // Undersized forest
				case 0x83: // Sparse forest
					return 0x50; // Forest

				case 0x84: // Burnt/dead forest
				case 0x85: // Stumped forest
					return 0;

				case 0x86: // Vineyard
					return 0x4e; // Orchard/plantation

				case 0x87: // Rice field
					return 0x51; // Wetland/swamp

				case 0x88: // Meadow
				case 0x89: // Sand
				case 0x8a: // Stony land
					return 0;

				case 0x8b: // Saline land/Salt-marsh
				case 0x8c: // Reed
				case 0x8d: // Algae
					return 0x51; // Wetland/swamp

				case 0x8e: // Thornbush
					return 0x4f; // Scrub

				case 0x8f: // Wind-fallen trees
					return 0x50; // Forest

				case 0x90: // Elfin wood
				case 0x91: // Saxaul
					return 0x4f; // Scrub

				case 0x92: // Bamboo
				case 0x93: // Palm forest
				case 0x94: // Mangroves
					return 0x50; // Forest

				case 0x95: // High grass
				case 0x96: // Mosses
				case 0x97: // Lichens
					return 0;
			}
			break;
	}
	return _ushType;
}

DECLARE_TYPESET_CONVERTOR (ConvertTypeSet_Navitel2Garmin, & g_tsNavitel, & g_tsGarmin);

USHORT ConvertTypeSet_Navitel2Russa (RGN_KIND _Kind, USHORT _ushType) {
	switch (_Kind) {
		case rkPolyline:
			switch (_ushType) {
				case 0x48: // Forest firebreak
					return 0x16; // Path/Walkway
				case 0x49: // Traffic lane
					return 0x00; // Road
			}
			break;

		case rkPolygon:
			switch (_ushType) {
				case 0x6d: // Commercial building
				case 0x6e: // Community building
				case 0x6f: // Industrial building
					return 0x13; // Man-made area
			}
			break;
	}
	return _ushType;
}

DECLARE_TYPESET_CONVERTOR (ConvertTypeSet_Navitel2Russa, & g_tsNavitel, & g_tsRussa);